import { EntityModel } from '@midwayjs/orm';
import {
  Column,
  CreateDateColumn,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

@EntityModel('outbound') // 可以指定表名，不指定会根据类名自己生成
export class Outbound {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  order_id: number;

  @Column()
  inventory_id: number;

  @Column()
  product_code: string;

  @Column({
    nullable: false,
  })
  weight: string;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  buying_price: string;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  payment_amount: number;

  @Column({
    nullable: false,
  })
  box_gauge: string;

  @Column({
    nullable: false,
  })
  inventory_product_quantity: number;

  @Column({
    nullable: false,
  })
  brand_side: string;

  @Column({
    nullable: false,
  })
  supplier: string;

  @Column({
    nullable: false,
  })
  whether_to_rebate: string;

  @Column({
    nullable: false,
  })
  warehousing_time: Date;

  @Column({
    nullable: false,
  })
  remaining_inventory_quantity: number;

  @Column({
    nullable: false,
  })
  outbound_product_quantity: number;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  rebate_rate: number;

  @Column({
    nullable: false,
  })
  rebate: number;

  @Column({
    nullable: false,
  })
  cost_params: string;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  cost: number;

  @Column({
    nullable: false,
  })
  source: string;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  unit_price: number;

  @Column()
  order_number: string;

  @Column()
  parent_order_number: string;

  @Column()
  product_name: string;

  @Column()
  order_product_quantity: number;

  @Column()
  product_id: string;

  @Column()
  product_specification: number;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  product_unit: number;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  order_payable_amount: number;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  merchant_price_change: number;

  @Column({
    type: 'date',
  })
  order_submission_time: Date;

  @Column()
  status: string;

  @Column()
  traffic_genres: string;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  actual_platform_discount: number;

  @Column({
    nullable: false,
    type: 'decimal',
    precision: 20,
    scale: 10,
  })
  actual_discounts_for_influencer: number;

  @Column()
  store_name: string;

  @Column({
    type: 'date',
  })
  data_date: Date;

  @CreateDateColumn({ comment: '创建时间', type: 'timestamp' })
  created_at: Date;

  @UpdateDateColumn({ comment: '更新时间', type: 'timestamp' })
  updated_at: Date;
}
